<?php
    /**
     * Created by PhpStorm.
     * User: mybook-lhp
     * Date: 18/10/21
     * Time: 下午3:38
     */

    namespace app\cms\api;


    use app\common\controller\API;
    use app\cms\model\SliderPopup as SliderPopupModel;

    class SliderPopup extends API
    {

        /**
         * 首页活动获取弹窗
         * api POST /cms/slider_popup/get
         *
         * @param null $id 弹窗id
         *
         * @throws \think\exception\DbException
         */
        public function get($id = null)
        {

            if ($id == null)
                $this->error('参数错误!');
            $SliderPopup          = SliderPopupModel::get($id);
            $SliderPopup['image'] = get_file_path($SliderPopup['image']);
            //            $SliderPopup['image'] ='';
            $this->result($SliderPopup);
        }

        /**
         * 商城获取弹窗
         * api POST /cms/slider_popup/get
         *
         * @param null $id 弹窗id
         *
         * @throws \think\exception\DbException
         */
        public function shop_get($id = null)
        {

            if ($id == null)
                $this->error('参数错误!');
            $SliderPopup          = SliderPopupModel::get($id);
            $SliderPopup['image'] = get_file_path($SliderPopup['image']);
//            $SliderPopup['image'] = '';
            $this->result($SliderPopup);
        }

    }